package com.mongo.controller;

import com.mongo.entity.UserInfo;
import com.mongo.service.UserInfoService;
import com.mongo.vo.UserInfoVo;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName UserInfoController
 * @Description UserInfo接口请求层
 * @Author Z咸鱼有梦
 * @Date 2019/12/02 0025 15:28
 * @Version 1.0
 */
@RestController
@RequestMapping("/api/v1/user")
public class UserInfoController {

    @Autowired
    private UserInfoService userInfoService;

    /**
     * 保存用户信息
     * @return
     */
    @PostMapping("/saveUser")
    public String saveUser(@RequestBody UserInfoVo userInfoVo){
        UserInfo userInfo = new UserInfo();
        BeanUtils.copyProperties(userInfoVo,userInfo);
        userInfoService.save(userInfo);
      return "SUCCESS";
    }
}
